package com.caine.tool;

import java.util.Map;

public class MapTool {

    public static Object getValue(Map<String, ?> map, String key, Object defaultVal) {
        Object o = map.get(key);
        if (o != null) {
            return o;
        } else {
            return defaultVal;
        }
    }

    public static String getStringValue(Map<String, ?> map, String key) {
        Object value = getValue(map, key, null);
        return value != null ? value.toString() : null;
    }
}
